package com.cloud.bssp.gateway.feign;

import com.cloud.bssp.gateway.dto.UserDTO;
import com.cloud.bssp.gateway.util.R;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author weirx
 * @date 2021/07/08 11:10
 **/
@Slf4j
@Component
public class UserClientImpl implements FallbackFactory<UserClient> {
    @Override
    public UserClient create(Throwable throwable) {
        return new UserClient() {
            @Override
            public R login(UserDTO userDTO) {
                log.info("调用用户服务失败，对用户服务降级处理。");
                return R.failed("调用用户服务失败，对用户服务降级处理");
            }
        };
    }
}
